<script>
//从左上角到右下角有多少条路径？1为障碍物，0可行。
let arr = [
    [0,0,0],
    [0,0,0],
    [0,0,0]
]
var sum = 1

fn(0,0)
function fn(i,j){
    var temp = 0
    if(arr[i+1] && arr[i+1][j] === 0){
        temp++
        fn(i+1,j)
    }
    if(arr[i][j+1] === 0){
        temp++
        fn(i,j+1)
    }
    if(temp == 2){
        sum += 1
    }else if(temp == 0 && i != 2 && j != 2){
        sum -= 1
    }
}

console.log(sum);

</script>